package com.hx.setting.service.imp;

import com.hx.setting.entity.Entity;
import com.hx.setting.entity.UsersEntity;
import com.hx.setting.model.Condition;
import com.hx.setting.model.GeneratedCriteria;
import com.hx.setting.model.Page;
import com.hx.setting.model.TableField;
import com.hx.setting.model.UsersModel.UsersTableField;
import com.hx.setting.model.UsersModel;
import com.hx.setting.service.BaseService;
import com.hx.setting.service.UsersService;
import com.hx.setting.service.imp.BaseServiceImp;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Mybatis base dao,封装了对数据库常用操作.
 * Generate Date : 2014-03-16
 * Generate Version : v3.0
 * Generate Name : Honey v3.1 Test
 * Generate User : THINK
 * JDK Version : 1.5
 */
@SuppressWarnings("unchecked")
public class UsersServiceImp<E extends UsersEntity, PK extends Serializable> extends BaseServiceImp<E, PK> implements UsersService<E, PK>
{

	@Override
	public List<E> select(E entity, Page page)
	{
		Condition c = new Condition( new UsersModel() );
		GeneratedCriteria m = c.or();
		if ( entity.getId() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "id" ) ,entity.getId() );
		}
		if ( entity.getUserName() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "userName" ) ,entity.getUserName() );
		}
		if ( entity.getUserPassword() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "userPassword" ) ,entity.getUserPassword() );
		}
		if ( entity.getFirstName() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "firstName" ) ,entity.getFirstName() );
		}
		if ( entity.getLastName() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "lastName" ) ,entity.getLastName() );
		}
		if ( entity.getReportsToId() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "reportsToId" ) ,entity.getReportsToId() );
		}
		if ( entity.getIsAdmin() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "isAdmin" ) ,entity.getIsAdmin() );
		}
		if ( entity.getDateEntered() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "dateEntered" ) ,entity.getDateEntered() );
		}
		if ( entity.getDateModified() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "dateModified" ) ,entity.getDateModified() );
		}
		if ( entity.getModifiedUserId() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "modifiedUserId" ) ,entity.getModifiedUserId() );
		}
		if ( entity.getPosition() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "position" ) ,entity.getPosition() );
		}
		if ( entity.getDepartment() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "department" ) ,entity.getDepartment() );
		}
		if ( entity.getPhoneHome() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "phoneHome" ) ,entity.getPhoneHome() );
		}
		if ( entity.getPhoneMobile() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "phoneMobile" ) ,entity.getPhoneMobile() );
		}
		if ( entity.getPhoneWork() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "phoneWork" ) ,entity.getPhoneWork() );
		}
		if ( entity.getPhoneOther() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "phoneOther" ) ,entity.getPhoneOther() );
		}
		if ( entity.getPhoneFax() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "phoneFax" ) ,entity.getPhoneFax() );
		}
		if ( entity.getEmail1() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "email1" ) ,entity.getEmail1() );
		}
		if ( entity.getEmail2() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "email2" ) ,entity.getEmail2() );
		}
		if ( entity.getStatus() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "status" ) ,entity.getStatus() );
		}
		if ( entity.getAddressStreet() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "addressStreet" ) ,entity.getAddressStreet() );
		}
		if ( entity.getAddressCity() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "addressCity" ) ,entity.getAddressCity() );
		}
		if ( entity.getAddressState() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "addressState" ) ,entity.getAddressState() );
		}
		if ( entity.getAddressCountry() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "addressCountry" ) ,entity.getAddressCountry() );
		}
		if ( entity.getAddressPostalcode() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "addressPostalcode" ) ,entity.getAddressPostalcode() );
		}
		if ( entity.getWeekstart() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "weekstart" ) ,entity.getWeekstart() );
		}
		if ( entity.getDateFormat() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "dateFormat" ) ,entity.getDateFormat() );
		}
		if ( entity.getHourFormat() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "hourFormat" ) ,entity.getHourFormat() );
		}
		if ( entity.getStartHour() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "startHour" ) ,entity.getStartHour() );
		}
		if ( entity.getEndHour() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "endHour" ) ,entity.getEndHour() );
		}
		if ( entity.getActivityView() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "activityView" ) ,entity.getActivityView() );
		}
		if ( entity.getLeadView() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "leadView" ) ,entity.getLeadView() );
		}
		if ( entity.getImagename() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "imagename" ) ,entity.getImagename() );
		}
		if ( entity.getDeleted() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "deleted" ) ,entity.getDeleted() );
		}
		if ( entity.getConfirmPassword() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "confirmPassword" ) ,entity.getConfirmPassword() );
		}
		if ( entity.getInternalMailer() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "internalMailer" ) ,entity.getInternalMailer() );
		}
		if ( entity.getReminderInterval() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "reminderInterval" ) ,entity.getReminderInterval() );
		}
		if ( entity.getReminderNextTime() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "reminderNextTime" ) ,entity.getReminderNextTime() );
		}
		if ( entity.getCryptType() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "cryptType" ) ,entity.getCryptType() );
		}
		if ( entity.getAccesskey() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "accesskey" ) ,entity.getAccesskey() );
		}
		if ( entity.getTheme() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "theme" ) ,entity.getTheme() );
		}
		if ( entity.getLanguage() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "language" ) ,entity.getLanguage() );
		}
		if ( entity.getTimeZone() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "timeZone" ) ,entity.getTimeZone() );
		}
		if ( entity.getCurrencyGroupingPattern() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "currencyGroupingPattern" ) ,entity.getCurrencyGroupingPattern() );
		}
		if ( entity.getCurrencyDecimalSeparator() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "currencyDecimalSeparator" ) ,entity.getCurrencyDecimalSeparator() );
		}
		if ( entity.getCurrencyGroupingSeparator() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "currencyGroupingSeparator" ) ,entity.getCurrencyGroupingSeparator() );
		}
		if ( entity.getCurrencySymbolPlacement() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "currencySymbolPlacement" ) ,entity.getCurrencySymbolPlacement() );
		}
		if ( entity.getNoOfCurrencyDecimals() != null )
		{
			m.andEqualTo( UsersTableField.getInstance( "noOfCurrencyDecimals" ) ,entity.getNoOfCurrencyDecimals() );
		}
		return baseDao.selectByDynamic( c ,page );
	}

	@Override
	public List<E> select(Map<String, Object> map, Page page)
	{
		Condition c = new Condition( new UsersModel() );
		GeneratedCriteria m = c.or();
		Enum e = null;
		for ( Map.Entry<String, Object> entity : map.entrySet() )
		{
			e = UsersTableField.getInstance( entity.getKey() );
			if ( e != null )
			{
				m.andEqualTo( e ,entity.getValue() );
			}
		}
		return baseDao.selectByDynamic( c ,page );
	}

	@Override
	public TableField getTableField(String property)
	{
		return UsersTableField.getInstance( property );
	}
}
/* Honey v3.1 Test - version:4 - OriginalChecksum:Ba6f8fb44acb7355283e430d6a9c50601 (do not edit this line) */
